package com.upbos.school;

import com.upbos.entity.App;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("app")
public class SchoolController {

	@Resource
	private SchoolService schoolService;

	/**
	 * 查询应用列表
	 * @param name 应用名称
	 * @return 应用列表
	 */
	@RequestMapping("listApp")
	public List<App> listApp(String name) {
		return schoolService.listApp(name);
	}

	/**
	 * 保存应用信息
	 * @param app 应用信息
	 */
	@RequestMapping(value = "saveApp", method = RequestMethod.POST)
	public void saveApp(App app) {
		schoolService.saveApp(app);
	}

	/**
	 * 删除应用信息
	 * @param app 应用信息
	 */
	@RequestMapping(value = "deleteApp", method = RequestMethod.POST)
	public void deleteApp(App app) {
		schoolService.deleteApp(app);
	}
}
